package com.boot.statemachine.config;

import org.apache.log4j.Logger;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;

/**
 * @author canger
 * @Deseription 注解方式状态机的配置
 * @create 2018/9/10 14:54
 **/
@WithStateMachine
public class EventConfig {

    private Logger logger = Logger.getLogger(getClass());

    @OnTransition(target = "UNPAID")
    public void create(){
        logger.info("订单创建，待支付");
    }
    @OnTransition(source = "UNPAID",target = "WAITING_FOR_RECEIVE")
    public void payStart(){
        logger.info("用户完成支付，待收货:start");
    }
    @OnTransition(source = "UNPAID",target = "WAITING_FOR_RECEIVE")
    public void payEnd(){
        logger.info("用户完成支付，待收货:end");
    }
    @OnTransition(source = "WAITING_FOR_RECEIVE",target = "DONE")
    public void receive(){
        logger.info("用户已收货，订单完成");
    }


}
